package top.go2do.websiteNavigation.business.website.module;

import jakarta.persistence.*;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @Description
 * @Author xingyj
 * @CreateTime 2025/6/26 13:58
 */
@Entity
@Table(name = "user_websites")
@IdClass(WebsiteUserId.class)
@Data
public class UserWebsitePO {

    @Id
    @Column(name = "website_id", columnDefinition = "BIGINT UNSIGNED COMMENT '网址ID(雪花算法分布式ID)'")
    private Long websiteId;

    @Id
    @Column(name = "user_id", columnDefinition = "BIGINT UNSIGNED COMMENT '用户ID(雪花算法分布式ID)'")
    private Long userId;

    @Column(name = "action_type", nullable = false, columnDefinition = "INT UNSIGNED  COMMENT '动作类型：1点赞, 2收藏'")
    private Integer actionType;

    @Column(name = "created_at", nullable = false, insertable = false, updatable = false,
            columnDefinition = "DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) COMMENT '创建时间'")
    private LocalDateTime createdAt;

}

class WebsiteUserId implements Serializable {
    private Long websiteId;
    private Long userId;
}
